package com.feicheng.house.controller;


import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.databind.ser.std.StdArraySerializers.FloatArraySerializer;
import com.feicheng.house.entity.Shop;
import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.service.IShopService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-11-05
 */
@RestController
@RequestMapping("/house/shop")
public class ShopController {
	@Autowired
	private IShopService iShopService;
	/**
	 * 查询门店列表-根据条件分页查询所有门店
	 * 
	 * @param currentPage 当前页
	 * @param pageSize 每页条数
	 * @param searchKey 搜索条件
	 * @return 所有仓库信息
	 */
	@GetMapping("/page")
	public ResultInfo all(
			@RequestParam(required = false, defaultValue = "1") Integer currentPage,
			@RequestParam(required = false, defaultValue = "10") Integer pageSize, 
			String searchKey) {
		return iShopService.getAllShop(currentPage, pageSize, searchKey);
	}
	/**
	 * 查询门店详情
	 * 
	 * @param shopId 门店Id
	 * @return 门店详情
	 */
	@GetMapping("/info")
	public ResultInfo getOne(Integer shopId) {
		return iShopService.getOne(shopId);
	}
	/**
	 * 新增门店
	 * @param shop 门店对象
	 * @return Boolean值
	 */
	@PostMapping("/info")
	public ResultInfo add(Shop shop,String menjins) {
		return iShopService.add(shop,menjins);
	}
	/**
	 * 修改门店
	 * @param shop 门店对象
	 * @return Boolean值
	 */
	@PutMapping("/info")
	public ResultInfo change(Shop shop,String menjins) {
		return iShopService.change(shop,menjins);
	}
	/**
	 * 删除门店
	 * @param shopId 门店Id
	 * @return Boolean值
	 */
	@DeleteMapping("/info")
	public ResultInfo deleteshop(Integer shopId) {
		return iShopService.deleteshop(shopId);
	}
			
	
			
}

